package com.hf.uncompress.controller;

import com.hf.uncompress.Result.AjaxList;
import com.hf.uncompress.service.FileUploadService;
import com.hf.uncompress.vo.PackParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

/**
 * @Description:
 * @Date: 2019/1/22
 * @Auther:
 */

@Controller
@RequestMapping("/user")
@Slf4j
public class FileUploadController {

    @Autowired
    private FileUploadService fileUploadService;

    @GetMapping("/redirect")
    public String redirectHtml() {
        return "work";
    }

    @PostMapping("/upload/zip")
    @ResponseBody
    public String uploadZip(MultipartFile zipFile, @RequestBody PackParam packParam) {
        AjaxList<String> ajaxList = fileUploadService.handlerUpload(zipFile, packParam);
        return ajaxList.getData();
    }
}
